package com.joker.yuwu;

import com.joker.repository.Rootupdatezg;
import com.joker.repository.Rootupdatezw;
import net.sf.json.JSONObject;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/rootupdatezw")
public class RootUpdateZw extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        super.doGet(req, resp);
        req.setCharacterEncoding("utf-8");
        String zwname=req.getParameter("zwname");
        String zhuangtai=req.getParameter("zhangtai");
        String username=req.getParameter("username");
        Rootupdatezw r1=new Rootupdatezw();
        boolean b1=r1.update(username,zwname);
        JSONObject obj=new JSONObject();
        obj.put("data",b1);
//        resp.getWriter().write(obj.toString());
        resp.sendRedirect("/admin/zwdesign.html");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
